package com.itheima.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component("teacher")
@Aspect
public class Teacher {

    // 配置点
    @Pointcut("execution(* *..*(..))")
    public void pc(){

    }

    @Around("pc()")
    public Object around(ProceedingJoinPoint pjp) {
        System.out.println("每日回顾...");
        Object ret = null;
        try {
            //对原始方法的调用
            ret = pjp.proceed();

            System.out.println("每日总结...");
        } catch (Throwable throwable) {
            System.out.println("解答问题...");
        } finally {
            System.out.println("高薪就业...");
        }
        return ret;
    }
}
